package com.mars.foodserver.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mars.foodserver.entity.Food;
import com.mars.foodserver.entity.FoodList;
import com.mars.foodserver.entity.FoodType;
import com.mars.foodserver.mapper.FoodListMapper;
import com.mars.foodserver.mapper.FoodMapper;
import com.mars.foodserver.mapper.FoodTypeMapper;
import com.mars.foodserver.request.FoodTypeRequest;
import com.mars.foodserver.response.FoodResponse;
import com.mars.foodserver.response.FoodTypeDetailResponse;
import com.mars.foodserver.response.FoodTypeListResp;
import com.mars.foodserver.response.base.PageInfo;
import com.mars.foodserver.service.IFoodListService;
import com.mars.foodserver.service.IFoodTypeService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import javax.annotation.Resource;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author wq
 * @since 2021-07-19
 */
@Service
public class FoodListServiceImpl extends ServiceImpl<FoodListMapper, FoodList> implements IFoodListService {


    @Override
    public List<String> foodList(Integer foodId) {
        return baseMapper.selectList(new LambdaQueryWrapper<FoodList>().
                eq(FoodList::getFoodId, foodId)).stream().
                map(x -> x.getFoodListDetail().replace(",", "—————————")).
                collect(Collectors.toList());
    }
}
